#pragma once
#include <iostream>
#include <memory>

//抽象构件类Transform
class Transform{
public:
	virtual void move() = 0;
}; 


//具体构件类Car
class Car : public Transform{
public:
	Car(){
		std::cout << "变形金刚是一辆车！" << std::endl;
	}
	
	void move(){
		std::cout << "在陆地上移动。" << std::endl;
	}
}; 


//抽象装饰类
class Changer : public Transform{
public:
	Changer(std::shared_ptr<Transform> transform){
		this->transform = transform;
	}
	void move(){
		transform->move();
	}
private:
	std::shared_ptr<Transform> transform; 
}; 

//具体装饰类Robot
class Robot : public Changer{
public:
	Robot(std::shared_ptr<Transform> transform) : Changer(transform){
		std::cout << "变成机器人!" << std::endl;
	}
	
	void say(){
		std::cout << "说话!" << std::endl;
	}
}; 

//具体装饰类AirPlane
class Airplane : public Changer{
public:
	Airplane(std::shared_ptr<Transform> transform) : Changer(transform){
		std::cout << "变成飞机!" << std::endl;
	}
	
	void say(){
		std::cout << "在天空飞翔!" << std::endl;
	}	
}; 